package src.first;

public class Employee implements Comparable<Employee>{
    private int id;
    private String name;
    private int age;

    public Employee() {
    }

    public Employee(int id, String name, int age) {
        this.id = id;
        this.name = name;
        this.age = age;
    }



    @Override
    public int compareTo(Employee o) {
        if(id > o.id){
            return 1;
        }else if(id < o.id){
            return -1;
        }
        return 0;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("员工的编号："+id+",");
        builder.append("员工的姓名："+name+",");
        builder.append("员工的年龄："+age+",");
        return builder.toString();
    }
}
